package o;

import android.app.Activity;
import android.text.TextUtils;
import com.huawei.appgallery.foundation.ui.framework.cardframe.bean.BaseCardBean;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class ebi {
    private static ebi ˊ = new ebi();
    private static final List<String> ॱ = new ArrayList();
    private Map<String, ebe> ˎ = new HashMap();
    private Map<String, Long> ˏ = new HashMap();

    private ebi() {
    }

    public static void add(String str) {
        if (!TextUtils.isEmpty(str) && !ॱ.contains(str)) {
            ॱ.add(str);
        }
    }

    public static boolean ˏ(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        return ॱ.contains(str);
    }

    public static ebi ˊ() {
        return ˊ;
    }

    public void ˎ(ebe o_ebe) {
        if (o_ebe != null && !TextUtils.isEmpty(o_ebe.ˏ())) {
            this.ˎ.put(o_ebe.ˏ(), o_ebe);
        }
    }

    public ebe ˊ(String str, String str2) {
        if (CollectCheck.isEmpty(this.ˎ) || TextUtils.isEmpty(str) || !this.ˎ.containsKey(str) || !ˎ(str2)) {
            return null;
        }
        ebe o_ebe = (ebe) this.ˎ.get(str);
        this.ˎ.remove(str);
        return o_ebe;
    }

    private boolean ˎ(String str) {
        if (TextUtils.isEmpty(str)) {
            return true;
        }
        Iterator it = this.ˎ.entrySet().iterator();
        while (it.hasNext()) {
            if (TextUtils.equals(str, ((ebe) ((Entry) it.next()).getValue()).ˊ())) {
                it.remove();
                return false;
            }
        }
        return true;
    }

    public long ˊ(String str) {
        if (TextUtils.isEmpty(str)) {
            return -1;
        }
        if (this.ˏ.containsKey(str)) {
            Long l = (Long) this.ˏ.get(str);
            if (l != null) {
                return l.longValue();
            }
        }
        return -1;
    }

    public void ˋ(String str, long j) {
        if (!TextUtils.isEmpty(str)) {
            this.ˏ.put(str, Long.valueOf(j));
        }
    }

    public void ॱ(Activity activity, BaseCardBean baseCardBean) {
        if ((!cii.ˎ(baseCardBean.ॱॱ()) || (baseCardBean.ॱॱ() != null && baseCardBean.ॱॱ().startsWith("app|"))) && (activity instanceof ebf)) {
            ((ebf) activity).ˎ(baseCardBean.ॱꓸ(), baseCardBean, 0);
        }
    }
}
